package com.wedata.海康云;

import cn.hutool.json.JSONObject;
import com.wedata.HttpUtils;

public class 设备管理 extends BaseService{

    public static void main(String[] args) {
        queryDevice("J96243743");
    }

    /**
     * 查询设备信息
     * @return
     */
    public static String queryDevice(String deviceSerial){
        JSONObject param = new JSONObject();
        param.set("deviceSerial", deviceSerial);
        //param.set("deviceSerial","K61132218");
        //{"msg":"操作成功","code":"200","data":{"deviceType":"DS-K1T672MW","resources":[{"openStatus":1,"channelNo":1,"supportCloud":0,"onlineStatus":1,"indexCode":"K61132218#1","statusChg":false,"cloudStoreStatus":-1,"orgId":572360229919408,"isencrypt":0,"cloudStoreStatusStr":"未知状态","onlineStatusStr":"在线","ezvizType":"V","name":"健萌旺德府店1号@1","allocationStatusStr":"禁用","supportCloudStr":"不支持云存储","allocationStatus":0}],"modelType":"ACCESS","deviceName":"旺德府私教馆-1","treatyType":"ezviz_net","deviceSerial":"K61132218","netAddress":"113.246.253.229","productCode":"1646638166955231","deviceCategory":"AccessControl","connection":{},"deviceRelatedInfo":{"defence":1,"onlineStatus":1,"deviceFrom":{},"deviceOrgId":572360229919408,"isencrypt":0},"projectId":361013479217840}}
        //param.set("deviceSerial","AE6891584");AE6891584
        //{"msg":"操作成功","code":"200","data":{"deviceType":"DS-K1T672MW","resources":[{"openStatus":1,"channelNo":1,"supportCloud":0,"onlineStatus":0,"indexCode":"AE6891584#1","statusChg":false,"cloudStoreStatus":-1,"orgId":572360229919408,"isencrypt":0,"cloudStoreStatusStr":"未知状态","onlineStatusStr":"离线","ezvizType":"V","name":"碧桂园@1","allocationStatusStr":"禁用","supportCloudStr":"不支持云存储","allocationStatus":0}],"modelType":"ACCESS","deviceName":"碧桂园","treatyType":"ezviz_net","deviceSerial":"AE6891584","netAddress":"36.157.206.108","productCode":"1646638166955231","deviceCategory":"AccessControl","connection":{},"deviceRelatedInfo":{"defence":1,"onlineStatus":0,"deviceOrgId":572360229919408,"isencrypt":0},"projectId":361013479217840}}
        //{"msg":"操作成功","code":"200","data":{"deviceType":"DS-K1T672MW","resources":[{"openStatus":1,"channelNo":1,"supportCloud":0,"onlineStatus":1,"indexCode":"AE6891584#1","statusChg":false,"cloudStoreStatus":-1,"orgId":572360229919408,"isencrypt":0,"cloudStoreStatusStr":"未知状态","onlineStatusStr":"在线","ezvizType":"V","name":"碧桂园@1","allocationStatusStr":"禁用","supportCloudStr":"不支持云存储","allocationStatus":0}],"modelType":"ACCESS","deviceName":"碧桂园","treatyType":"ezviz_net","deviceSerial":"AE6891584","netAddress":"36.157.206.108","productCode":"1646638166955231","deviceCategory":"AccessControl","connection":{},"deviceRelatedInfo":{"defence":1,"onlineStatus":1,"deviceOrgId":572360229919408,"isencrypt":0},"projectId":361013479217840}}
        //{"msg":"操作成功","code":"200","data":{"deviceType":"DS-K1T672MW","resources":[{"openStatus":1,"channelNo":1,"supportCloud":0,"onlineStatus":1,"indexCode":"J96243743#1","statusChg":false,"cloudStoreStatus":-1,"orgId":572360229919408,"isencrypt":0,"cloudStoreStatusStr":"未知状态","onlineStatusStr":"在线","ezvizType":"V","name":"芒果店3@1","allocationStatusStr":"启用","supportCloudStr":"不支持云存储","allocationStatus":1}],"modelType":"ACCESS","deviceName":"归心苑芒果私教馆-负一楼","treatyType":"ezviz_net","deviceSerial":"J96243743","productCode":"1646638166955231","deviceCategory":"AccessControl","connection":{},"deviceRelatedInfo":{"onlineStatus":1,"deviceFrom":{},"deviceOrgId":572360229919408,"isencrypt":-1},"projectId":361013479217840}}
        JSONObject header = new JSONObject("{\"access_token\":\""+getToken()+"\"}");
        JSONObject jsonObject = HttpUtils.sendPost("https://open.hikyun.com/artemis/api/eits/v2/global/device/info",header,param);

        System.out.println(jsonObject);
        //{"code":"200","msg":"操作成功","data":{"projectId":361013479217840,"productCode":"1646638166955231","deviceName":"开福万达广场私教馆","deviceSerial":"J61020448","deviceCategory":"AccessControl","treatyType":"ezviz_net","deviceType":"DS-K1T672MW","modelType":"ACCESS","connection":{},"deviceRelatedInfo":{"deviceOrgId":572360229919408,"isencrypt":-1,"onlineStatus":1,"deviceFrom":{}},"resources":[{"ezvizType":"V","channelNo":1,"indexCode":"J61020448#1","name":"万达私教馆@1","orgId":572360229919408,"onlineStatus":1,"onlineStatusStr":"在线","allocationStatus":1,"allocationStatusStr":"启用","openStatus":1,"isencrypt":0,"cloudStoreStatus":-1,"cloudStoreStatusStr":"未知状态","supportCloud":0,"supportCloudStr":"不支持云存储","statusChg":false}]}}
        //归心苑芒果私教馆: J96243743
        //{"msg":"操作成功","code":"200","data":{"deviceType":"DS-K1T672MW","resources":[{"openStatus":1,"channelNo":1,"supportCloud":0,"onlineStatus":1,"indexCode":"J96243743#1","statusChg":false,"cloudStoreStatus":-1,"orgId":572360229919408,"isencrypt":0,"cloudStoreStatusStr":"未知状态","onlineStatusStr":"在线","ezvizType":"V","name":"芒果店3@1","allocationStatusStr":"启用","supportCloudStr":"不支持云存储","allocationStatus":1}],"modelType":"ACCESS","deviceName":"归心苑芒果私教馆-负一楼","treatyType":"ezviz_net","deviceSerial":"J96243743","productCode":"1646638166955231","deviceCategory":"AccessControl","connection":{},"deviceRelatedInfo":{"onlineStatus":1,"deviceFrom":{},"deviceOrgId":572360229919408,"isencrypt":-1},"projectId":361013479217840}}
        return jsonObject.toString();
    }


}
